package Interface.Producao.Cortesias;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LerCortesias {
    
    private static LerCortesias instance = null;
    
    public LerCortesias() {
    }
    
    public static LerCortesias getInstance(){
        if(instance == null){
            instance = new LerCortesias();
        }
        return instance;
    }
    
    private List<String[]> list = new ArrayList<>();
    private String[] split = null;
    
    public List<String[]> lerArquivo(String filename){
        try {
            FileReader file = new FileReader(filename);
            BufferedReader buff = new BufferedReader(file);
            String readline = buff.readLine();
            
            while(readline != null){
                split = readline.split("	");
                list.add(split);
                
                readline = buff.readLine();
            }
            
        } catch (FileNotFoundException ex) {
            Logger.getLogger(LerCortesias.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(LerCortesias.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        
        return list;
    }
}
